package com.shop.dingdongshoppingapi.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shop.dingdongshoppingapi.dao.AdresseditDao;
import com.shop.dingdongshoppingapi.dto.AdressEditDto;
import com.shop.dingdongshoppingapi.entity.AdressEdit;
import com.shop.dingdongshoppingapi.service.intf.AdressEditService;
import com.shop.dingdongshoppingapi.vo.R;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;

@Service
public class AdressEditServiceImpl implements AdressEditService {
    @Resource
    private  AdresseditDao dao;


    @Override
    public R addAdress(AdressEditDto add) {
        dao.insert(new AdressEdit(add.getName(),add.getPhone(),add.getAddress()));
        return R.ok();
    }

    @Override
    public R deleteid(int id) {
        int i = dao.deleteById(id);
        return R.ok(i);
    }

    @Override
    public R selectAllAdress(int id) {
        QueryWrapper queryWrapper=new QueryWrapper<AdressEdit>();
        queryWrapper.eq("id",id);
        return R.ok(dao.selectList(queryWrapper));
    }
}
